﻿namespace CodingExercises._11_20;

public class SumInRange
{
    // 对可变长度输入的范围值求和
    public static int Method(int start, int end, params int[] numbers)
    {
        if (start < 0)
        {
            start = 0;
        }

        if (end > numbers.Length)
        {
            end = numbers.Length;
        }

        if (start >= end)
        {
            return 0;
        }

        return numbers[start..end].Sum();
    }
}